import sqlite3
con=sqlite3.connect("sales.db")
cur=con.cursor()
#cur.execute("DROP table student")  #第一次运行时这句删掉，之后再运行加上。
con.execute("create table student(stuid primary key,stuname varchar(20),birthday integer(20),sex varchar(20),address varchar(20),rxrq integer(20))")
cur.execute("insert into student(stuid,stuname,birthday,sex,address,rxrq) values (1,'张一',19980301,'男','黄河路1号',20160901)")
cur.execute("insert into student(stuid,stuname,birthday,sex,address,rxrq) values (2,'张二',19980302,'女','黄河路2号',20160902)")
cur.execute("insert into student(stuid,stuname,birthday,sex,address,rxrq) values (3,'张三',19980303,'男','黄河路3号',20160903)")
cur.execute("insert into student(stuid,stuname,birthday,sex,address,rxrq) values (4,'张四',19980304,'男','黄河路4号',20160904)")
cur.execute("insert into student(stuid,stuname,birthday,sex,address,rxrq) values (5,'张五',19980305,'女','黄河路5号',20160905)")
print('记录计入完成')
cur.execute('select * from student')
values = cur.fetchall()
for row in values:
    print(row)
print('记录更新完成')
cur.execute("Update student set rxrq=20170901")
cur.execute('select * from student')
values = cur.fetchall()
for row in values:
    print(row)
print('性别为女的名字和地址信息为：')
cur.execute('select stuname,sex,address from student')
values = cur.fetchall()
for row in values:
    if row[1]=='女':
     print(row[0],row[2])
cur.close()
con.commit()
con.close()